import 'package:flutter/material.dart';
import 'package:flutterdemo/common/event_bus.dart';

class EventBusDemo extends StatefulWidget {
  @override
  _EventBusDemoState createState() => _EventBusDemoState();
}

class _EventBusDemoState extends State<EventBusDemo> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('eventbus 通信'),
      ),
      // 父组件向子组件传值，及回调
      floatingActionButton: FloatingActionButton(
        child: Icon(Icons.add),
        onPressed: () {
          print("eventbus");
          eventBus.fire(HandleTestEventBus("aaa-"));
        },
      ),
    );
  }
}
